package com.hqj.util;

import java.io.File;

public class FileUtil {

    public  static void createDir(File f){
        try {
            //判断路径是否已经存在
            if(!f.exists()){
                f.mkdirs();//创建路径
            }

        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void createFile(File f){
        try {
            if(!f.exists()){
                f.createNewFile();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void delFile(File f){
        try {
            boolean b = f.delete();//删除文件
            System.out.println("删除"+(b?"成功":"失败"));
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        String path = "E:\\Entor\\files\\1591603233579.zip";
        File f = new File(path);
        delFile(f);
    }
}
